package com.sky.controller.user;

import com.sky.result.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.ValueOperations;
import org.springframework.web.bind.annotation.*;

@RestController("usershopcontroller")//为bean对象赋名字，避免和adminshopcontroller的bean对象名称冲突
@Slf4j
@Api(tags = "店铺状态接口")
@RequestMapping("/user/shop")
public class ShopController {
    @Autowired
    private RedisTemplate redisTemplate;

    @ApiOperation("查询营业状态")
    @GetMapping("/status")
    public Result select(){
        ValueOperations valueOperations = redisTemplate.opsForValue();
        String shopStatusStr = (String) valueOperations.get("SHOP_STATUS");
        Integer shop_status = Integer.parseInt(shopStatusStr);
        return Result.success(shop_status);
    }
}
